@echo off

@echo Creating RESOURCE.bin ...

@rem *** HDMI: Bootup hdmi. ***
AddMagicNumber.exe A1A2A3A4 BOOTUP_HDMI.bin

@rem *** Audio: Bootup sound. ***
AddMagicNumber.exe C3C4C5C6 BOOTUP.WAV


@rem *** Still: Shading data. ***
@rem Magic code: B2xxxxxx
@if exist FSHD_0.BIN AddMagicNumber.exe B2202122 FSHD_0.BIN
@if exist FSHD_1.BIN AddMagicNumber.exe B2232425 FSHD_1.BIN
@if exist FSHD_2.BIN AddMagicNumber.exe B2262728 FSHD_2.BIN

@rem *** Still: IQ data. ***
@rem Magic code: B3xxxxxx
@if exist IQ_0.BIN   AddMagicNumber.exe B3333435 IQ_0.BIN
@if exist IQ_1.BIN   AddMagicNumber.exe B3363718 IQ_1.BIN
@if exist IQ_2.BIN   AddMagicNumber.exe B3393A3B IQ_2.BIN
@if exist IQ_3.BIN   AddMagicNumber.exe B33C3D3E IQ_3.BIN
@if exist IQ_4.BIN   AddMagicNumber.exe B33F4041 IQ_4.BIN
@if exist IQ_5.BIN   AddMagicNumber.exe B3424344 IQ_5.BIN
@if exist IQ_6.BIN   AddMagicNumber.exe B3454647 IQ_6.BIN
@if exist IQ_7.BIN   AddMagicNumber.exe B348494A IQ_7.BIN
@if exist IQ_8.BIN   AddMagicNumber.exe B34B4C4D IQ_8.BIN
@if exist IQ_D.BIN   AddMagicNumber.exe B34E4F50 IQ_D.BIN

@rem *** Still: Warping distortion data. ***
@rem Magic code: B4xxxxxx
if exist WARPING.BIN  AddMagicNumber.exe B4404142 WARPING.BIN
if exist LDC0.BIN     AddMagicNumber.exe B4434445 LDC0.BIN
if exist LDC1.BIN     AddMagicNumber.exe B4464748 LDC1.BIN
if exist LDC2.BIN     AddMagicNumber.exe B4494A4B LDC2.BIN
if exist WARP_L.BIN   AddMagicNumber.exe B44C4D4E WARP_L.BIN
if exist WARP_R.BIN   AddMagicNumber.exe B44F5051 WARP_R.BIN
if exist CAM_CAL0.BIN AddMagicNumber.exe B4525354 CAM_CAL0.BIN
if exist CAM_CAL1.BIN AddMagicNumber.exe B4555657 CAM_CAL1.BIN

@rem *** Still: AE data. ***
@rem Magic code: B5xxxxxx
@if exist EVP_MAP.BIN   AddMagicNumber.exe B5505152 EVP_MAP.BIN

@rem *** Gamme table data. ***
@rem Magic code: B6xxxxxx
if exist gamFL1.bin AddMagicNumber.exe B6000102 gamFL1.BIN
if exist gamFL2.bin AddMagicNumber.exe B6030405 gamFL2.BIN
if exist gamFL3.bin AddMagicNumber.exe B6060708 gamFL3.BIN
if exist gamFL4.bin AddMagicNumber.exe B6090a0b gamFL4.BIN
if exist gamFL5.bin AddMagicNumber.exe B60c0d0e gamFL5.BIN
if exist gamFL6.bin AddMagicNumber.exe B60f1011 gamFL6.BIN
if exist gamFL7.bin AddMagicNumber.exe B6121314 gamFL7.BIN
if exist gamFL8.bin AddMagicNumber.exe B6151617 gamFL8.BIN

if exist gamDF1.bin AddMagicNumber.exe B618191a gamDF1.BIN
if exist gamDF2.bin AddMagicNumber.exe B61b1c1d gamDF2.BIN
if exist gamDF3.bin AddMagicNumber.exe B61e1f20 gamDF3.BIN
if exist gamDF4.bin AddMagicNumber.exe B6212223 gamDF4.BIN
if exist gamDF5.bin AddMagicNumber.exe B6242526 gamDF5.BIN
if exist gamDF6.bin AddMagicNumber.exe B6272829 gamDF6.BIN
if exist gamDF7.bin AddMagicNumber.exe B62a2b2c gamDF7.BIN
if exist gamDF8.bin AddMagicNumber.exe B62d2e2f gamDF8.BIN

@rem *** Custome IQ data. ***
@rem Magic code: B7xxxxxx
@if exist CCM1.BIN   AddMagicNumber.exe B7707172 CCM1.BIN

@rem *** RGB sensitivity data. ***
@rem Magic code: B8xxxxxx
@if exist RGB_sensitivity.BIN AddMagicNumber.exe B8808182 RGB_sensitivity.BIN

@rem *** Bad Pixel data. ***
@rem Magic code: B9xxxxxx
if exist BADPIX_0.bin AddMagicNumber.exe B9909192 BADPIX_0.BIN
if exist BADPIX_1.bin AddMagicNumber.exe B9939495 BADPIX_1.BIN
if exist BADPIX_2.bin AddMagicNumber.exe B9969798 BADPIX_2.BIN
if exist BADPIX_3.bin AddMagicNumber.exe B9999A9B BADPIX_3.BIN

@rem *** Terminator. ***
AddMagicNumber.exe EDEDEDED MagicNumber_End.bin


@rem *** Create Still command line.
@set STILL_RESOURCE=
@if exist FSHD_0.BIN  set STILL_RESOURCE=%STILL_RESOURCE% + wk\FSHD_0.BIN_addmagic/B
@if exist FSHD_1.BIN  set STILL_RESOURCE=%STILL_RESOURCE% + wk\FSHD_1.BIN_addmagic/B
@if exist FSHD_2.BIN  set STILL_RESOURCE=%STILL_RESOURCE% + wk\FSHD_2.BIN_addmagic/B

@if exist IQ_0.BIN    set STILL_RESOURCE=%STILL_RESOURCE% + wk\IQ_0.BIN_addmagic/B
@if exist IQ_1.BIN    set STILL_RESOURCE=%STILL_RESOURCE% + wk\IQ_1.BIN_addmagic/B
@if exist IQ_2.BIN    set STILL_RESOURCE=%STILL_RESOURCE% + wk\IQ_2.BIN_addmagic/B
@if exist IQ_3.BIN    set STILL_RESOURCE=%STILL_RESOURCE% + wk\IQ_3.BIN_addmagic/B
@if exist IQ_4.BIN    set STILL_RESOURCE=%STILL_RESOURCE% + wk\IQ_4.BIN_addmagic/B
@if exist IQ_5.BIN    set STILL_RESOURCE=%STILL_RESOURCE% + wk\IQ_5.BIN_addmagic/B
@if exist IQ_6.BIN    set STILL_RESOURCE=%STILL_RESOURCE% + wk\IQ_6.BIN_addmagic/B
@if exist IQ_7.BIN    set STILL_RESOURCE=%STILL_RESOURCE% + wk\IQ_7.BIN_addmagic/B
@if exist IQ_8.BIN    set STILL_RESOURCE=%STILL_RESOURCE% + wk\IQ_8.BIN_addmagic/B
@if exist IQ_D.BIN    set STILL_RESOURCE=%STILL_RESOURCE% + wk\IQ_D.BIN_addmagic/B

@if exist WARPING.BIN  set STILL_RESOURCE=%STILL_RESOURCE% + wk\WARPING.BIN_addmagic/B
@if exist LDC0.BIN     set STILL_RESOURCE=%STILL_RESOURCE% + wk\LDC0.BIN_addmagic/B
@if exist LDC1.BIN     set STILL_RESOURCE=%STILL_RESOURCE% + wk\LDC1.BIN_addmagic/B
@if exist LDC2.BIN     set STILL_RESOURCE=%STILL_RESOURCE% + wk\LDC2.BIN_addmagic/B
@if exist WARP_L.BIN   set STILL_RESOURCE=%STILL_RESOURCE% + wk\WARP_L.BIN_addmagic/B
@if exist WARP_R.BIN   set STILL_RESOURCE=%STILL_RESOURCE% + wk\WARP_R.BIN_addmagic/B
@if exist CAM_CAL0.BIN   set STILL_RESOURCE=%STILL_RESOURCE% + wk\CAM_CAL0.BIN_addmagic/B
@if exist CAM_CAL1.BIN   set STILL_RESOURCE=%STILL_RESOURCE% + wk\CAM_CAL1.BIN_addmagic/B

@if exist EVP_MAP.BIN	set STILL_RESOURCE=%STILL_RESOURCE% + wk\EVP_MAP.BIN_addmagic/B

@if exist gamFL1.bin set STILL_RESOURCE=%STILL_RESOURCE% + wk\gamFL1.BIN_addmagic/B
@if exist gamFL2.bin set STILL_RESOURCE=%STILL_RESOURCE% + wk\gamFL2.BIN_addmagic/B
@if exist gamFL3.bin set STILL_RESOURCE=%STILL_RESOURCE% + wk\gamFL3.BIN_addmagic/B
@if exist gamFL4.bin set STILL_RESOURCE=%STILL_RESOURCE% + wk\gamFL4.BIN_addmagic/B
@if exist gamFL5.bin set STILL_RESOURCE=%STILL_RESOURCE% + wk\gamFL5.BIN_addmagic/B
@if exist gamFL6.bin set STILL_RESOURCE=%STILL_RESOURCE% + wk\gamFL6.BIN_addmagic/B
@if exist gamFL7.bin set STILL_RESOURCE=%STILL_RESOURCE% + wk\gamFL7.BIN_addmagic/B
@if exist gamFL8.bin set STILL_RESOURCE=%STILL_RESOURCE% + wk\gamFL8.BIN_addmagic/B

@if exist gamDF1.bin set STILL_RESOURCE=%STILL_RESOURCE% + wk\gamDF1.BIN_addmagic/B
@if exist gamDF2.bin set STILL_RESOURCE=%STILL_RESOURCE% + wk\gamDF2.BIN_addmagic/B
@if exist gamDF3.bin set STILL_RESOURCE=%STILL_RESOURCE% + wk\gamDF3.BIN_addmagic/B
@if exist gamDF4.bin set STILL_RESOURCE=%STILL_RESOURCE% + wk\gamDF4.BIN_addmagic/B
@if exist gamDF5.bin set STILL_RESOURCE=%STILL_RESOURCE% + wk\gamDF5.BIN_addmagic/B
@if exist gamDF6.bin set STILL_RESOURCE=%STILL_RESOURCE% + wk\gamDF6.BIN_addmagic/B
@if exist gamDF7.bin set STILL_RESOURCE=%STILL_RESOURCE% + wk\gamDF7.BIN_addmagic/B
@if exist gamDF8.bin set STILL_RESOURCE=%STILL_RESOURCE% + wk\gamDF8.BIN_addmagic/B

@if exist CCM1.BIN    set STILL_RESOURCE=%STILL_RESOURCE% + wk\CCM1.BIN_addmagic/B

@if exist RGB_sensitivity.BIN set STILL_RESOURCE=%STILL_RESOURCE% + wk\RGB_sensitivity.BIN_addmagic/B

@if exist BADPIX_0.BIN set STILL_RESOURCE=%STILL_RESOURCE% + wk\BADPIX_0.BIN_addmagic/B
@if exist BADPIX_1.BIN set STILL_RESOURCE=%STILL_RESOURCE% + wk\BADPIX_1.BIN_addmagic/B
@if exist BADPIX_2.BIN set STILL_RESOURCE=%STILL_RESOURCE% + wk\BADPIX_2.BIN_addmagic/B
@if exist BADPIX_3.BIN set STILL_RESOURCE=%STILL_RESOURCE% + wk\BADPIX_3.BIN_addmagic/B

@rem Join all binary and output to RESOURCE.bin.
copy wk\BOOTUP_HDMI.bin_addmagic/B + wk\BOOTUP.WAV_addmagic/B %STILL_RESOURCE% + wk\MagicNumber_End.bin_addmagic/B RESOURCE.bin/B

@move RESOURCE.bin ../RESOURCE.bin

@echo %0
@echo complete !

endlocal
